package com.franklin.java.service.database;

import com.alibaba.druid.DbType;
import com.franklin.java.entity.sql.ColumnInfo;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 数据库处理器
 * @author Franklin
 * @since 2021/8/31 15:01
 */
public interface DatabaseHandler {

    /**
     * 解析数据库字段类型<br>
     * @author Franklin
     * @since 2021/8/31 16:45
     * @param columnInfoList:
     * @return void
     */
    void resolveColumnInfo(List<ColumnInfo> columnInfoList);

    /**
     * 数据库类型<br>
     * @author Franklin
     * @since 2021/8/31 16:45
     * @param :
     * @return com.alibaba.druid.DbType
     */
    default DbType getDbType(){
        return DbType.mysql;
    }

    /**
     * 从数据库中获取表字段<br>
     * @author Franklin
     * @since 2021/9/9 17:45
     * @param tableNames:
     * @return java.util.Map<java.lang.String,java.util.List<com.franklin.java.entity.sql.ColumnInfo>>
     */
    Map<String,List<ColumnInfo>> getColumns(Collection<String> tableNames);
}
